﻿//-----------------------------------------------------------------------
// <copyright file="Attributes.cs" company="Craig Longford (deltawolf7@gmail.com)">
//     Copyright (c) Craig Longford. All rights reserved.
// </copyright>
//-----------------------------------------------------------------------

namespace Delta.Mercury.Business.Commerce
{
    using System;
    using System.Collections.Generic;
    using Delta.Data.DataExpress;

    /// <summary>
    /// Collection of attrbiues
    /// </summary>
    [Serializable]
    public class Attributes : List<Attribute>
    {
        #region Constructors
        /// <summary>
        /// Initializes a new instance of the Attributes class.
        /// </summary>
        public Attributes()
        {
        }
        #endregion

        #region Load Methods
        /// <summary>
        /// Load attributes by product
        /// </summary>
        /// <param name="product">Product identifier</param>
        /// <returns>Collection of attributes</returns>
        public static Attributes Load(IProduct product)
        {
            Parameters parameters = new Parameters();
            parameters.Add(new Parameter("ProductGuid", product.Guid));
            return DataAccess.GetCollection<Attributes, Attribute>("LoadAttributes", System.Data.CommandType.StoredProcedure, parameters);
        }
        #endregion
    }
}
